<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Link
 *
 * @author guilherme
 */
class Link {
    var $tabela,$campos,$camposChaveO,$camposChaveD;

    function Link($tabela,$campos,$camposChaveO,$camposChaveD){
        $this->tabela = $tabela;
        $this->campos = $campos ;
        $this->camposChaveO = $camposChaveO;
        $this->camposChaveD = $camposChaveD;
    }

    function getField($i){
        return $this->campos[$i];
    }

    function getTable(){
        return $this->tabela;
    }

    function fieldCount(){
        return count($this->campos);
    }

    function getLink(){
        $aux = "inner join $this->tabela on ";
        $cond = $this->getTable()."$this->camposChaveO[0] = $this->camposChaveD[0]";
        for ($i =1;$i<count($this->camposChaveO);$i++){
            $cond += " and $this->camposChaveO[$i] = $this->camposChaveD[$i]";
        }
    }
}
?>
